package com.mobilepay.moneypig.response.address;

import android.support.annotation.NonNull;

import com.mobilepay.moneypig.response.ResponseResult;

import java.util.List;

/**
 * Created by xlm on 2017/8/18 0018
 */

public class AddressData extends ResponseResult {

    private List<DataBean> data;

    public List<DataBean> getData() {
        return data;
    }

    public void setData(List<DataBean> data) {
        this.data = data;
    }

    public static class DataBean implements Comparable<DataBean> {
        /**
         * type : areas1
         * id : 20200
         * pid : 20000
         * name : 天津市
         */

        private String type;
        private String id;
        private String pid;
        private String name;
        private String pinyin; // 第一个汉字拼音
        private String firstLetter; // 第一个汉字拼音的首字母
        private String allLetter; // 全部汉字拼音的首字母

        public String getAllLetter() {
            return allLetter;
        }

        public void setAllLetter(String allLetter) {
            this.allLetter = allLetter;
        }

        public String getPinyin() {
            return pinyin;
        }

        public void setPinyin(String pinyin) {
            this.pinyin = pinyin;
        }


        public String getType() {
            return type;
        }

        public String getFirstLetter() {
            return firstLetter;
        }

        public void setFirstLetter(String firstLetter) {
            this.firstLetter = firstLetter;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getPid() {
            return pid;
        }

        public void setPid(String pid) {
            this.pid = pid;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        @Override
        public int compareTo(@NonNull DataBean another) {
            if (firstLetter.equals("#") && !another.getFirstLetter().equals("#")) {
                return 1;
            } else if (!firstLetter.equals("#") && another.getFirstLetter().equals("#")) {
                return -1;
            } else {
                return pinyin.compareToIgnoreCase(another.getPinyin());
            }
        }
    }
}
